package C7_6_RemoveMiddleMan;

import org.junit.Test;

/**
 * 移除中间人
 */
public class Person {

    Department _department;

    /**重构前**/
    public Person getManager(){
        return _department.getManager();
    }

    /**重构后**/
    public Department getDepartment() {
        return _department;
    }

    public void setDepartment(Department department) {
        this._department = department;
    }

    @Test
    public void test(){
        Person john = new Person();
        //重构前
        john.getManager();
        //重构后
        john.getDepartment().getManager();
    }


}
